import request from '@/utils/request'
import { praseStrEmpty } from "@/utils/ruoyi";

//查询应用列表
export function listSite(data) {
  return request({
    url: '/admin/sites',
    method: 'post',
    data: data
  })
}

//根据应用名查询应用列表
export function getSiteByName(data) {
  return request({
    url: '/admin/site/getByName',
    method: 'post',
    data: data
  })
}

//查询应用
export function getSite(id) {
  return request({
    url: '/admin/site/' + id,
    method: 'get',
  })
}

//新增应用
export function addSite(data){
  return request({
    url: '/admin/site',
    method: 'post',
    data: data
  })
}

//修改应用
export function updateSite(data) {
  return request({
    url: '/admin/site',
    method: 'put',
    data: data
  })
}

//删除应用
export function delSite(id) {
  return request({
    url: '/admin/site/' + id,
    method: 'delete',
  })
}

//批量删除
export function delSites(ids) {
  return request({
    url: '/admin/sites',
    method: 'delete',
    data: ids
  })
}

//导出应用
export function exportSite(data) {
  return request({
    url: '/admin/sites/download',
    method: 'post',
    data: data,
    headers: {
      Accept: 'application/json',
      'Content-Type': 'application/json; charset=utf-8',
      withCredentials: true,
    },
    responseType: 'arraybuffer',//防止乱码
  })
}
